//路由配置
define(function (require, exports, module) {
    const Vue=require("vue");
    const VueRouter=require("VueRouter");
    const routerMap=[
        {
            path:'/',
            redirect:'/index'
        },
        {
            path:'/name',
            meta:{title:"实名认证",auth:true},
            component:function(resolve){
                return require(['views/name/index'], resolve);
            }
        },
        {
            path:'/phone',
            meta:{title:"手机验证"},
            component:function(resolve){
                return require(['views/phone/index'], resolve);
            }
        },
        {
            path:'/complete',
            meta:{title:"完成",auth:true},
            component:function(resolve){
                return require(['views/complete/index'], resolve);
            }
        },
        {
            path:'/deposit',
            meta:{title:"押金充值",auth:true},
            component:function(resolve){
                return require(['views/deposit/index'], resolve);
            }
        },
        {
            path:'/detail',
            meta:{title:"钱包金额明细",auth:true},
            component:function(resolve){
                return require(['views/detail/index'], resolve);
            }
        },
        {
            path:'/explain/:id',
            meta:{title:"关于优时智能车"},
            component:function(resolve){
                return require(['views/explain/index'], resolve);
            }
        },
        {
            path:'/fundDetail',
            meta:{title:"赠送资金明细",auth:true},
            component:function(resolve){
                return require(['views/fundDetail/index'], resolve);
            }
        },
        {
            path:'/guide',
            meta:{title:"用户指南"},
            component:function(resolve){
                return require(['views/guide/index'], resolve);
            }
        },
        {
            path:'/history',
            meta:{title:"信用分历史",auth:true},
            component:function(resolve){
                return require(['views/history/index'], resolve);
            }
        },
        {
            path:'/information',
            meta:{title:"个人信息",auth:true},
            component:function(resolve){
                return require(['views/information/index'], resolve);
            }
        },
        {
            path:'/recharge',
            meta:{title:"钱包充值",auth:true},
            component:function(resolve){
                return require(['views/recharge/index'], resolve);
            }
        },
        {
            path:'/wallet',
            meta:{title:"我的钱包",auth:true},
            component:function(resolve){
                return require(['views/wallet/index'], resolve);
            }
        },
        {
            path:'/invite',
            meta:{title:"邀请好友",auth:true},
            component:function(resolve){
                return require(['views/invite/index'], resolve);
            }
        },
        {
            path:'/credit',
            meta:{title:"信用历史",auth:true},
            component:function(resolve){
                return require(['views/credit/index'], resolve);
            }
        },
        {
            path:'/download',
            meta:{title:"APP下载"},
            component:function(resolve){
                return require(['views/download/index'], resolve);
            }
        },
        {
            path:'/about',
            meta:{title:"关于我们"},
            component:function(resolve){
                return require(['views/about/index'], resolve);
            }
        },
        {
            path:'/cycling/:code/:time',
            meta:{title:"骑行中",auth:true},
            component:function(resolve){
                return require(['views/cycling/index'], resolve);
            }
        },
        {
            path:'/index',
            meta:{title:"首页",auth:true},
            component:function(resolve){
                return require(['views/index/index'], resolve);
            }
        },
        {
            path:'/code',
            meta:{title:"关注公众号"},
            component:function(resolve){
                return require(['views/code/index'], resolve);
            }
        },
        {
            path:'/myTrip',
            meta:{title:"我的行程"},
            component:function(resolve){
                return require(['views/myTrip/index'], resolve);
            }
        },
        {
            path:'/us-ebike',
            meta:{title:"我的优时",auth:true},
            component:function(resolve){
                return require(['views/us-ebike/index'], resolve);
            }
        }
    ];

    //安装路由模块
    Vue.use(VueRouter);
    //加载路由配置
    const router=new VueRouter({
        mode: 'hash',
        routes: routerMap
    });
    //路由拦截
    router.beforeEach(function(to, from, next){
        // 修改页面标题
        if(to.meta&&to.meta.title){
            document.title = to.meta.title;
        }

        next();
    });
    //路由完成
    router.afterEach(function(){

    });
    //导出
    module.exports=router;
});